package yifeng.thread;

import java.util.concurrent.BrokenBarrierException;
import java.util.concurrent.CyclicBarrier;

public class CyclicBarrierExp {

	
	
	
	
	
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		CyclicBarrier cb = new CyclicBarrier(3, 
				new Runnable(){
				@Override
				public void run() {
					try {
						Thread.sleep(3000);
					} catch (InterruptedException e) {
						e.printStackTrace();
					}
					System.out.println("Game starting!");
				}
		});
		
		for(int i = 0; i < 3; i++){
			new MyThread("Thread" + i, cb).start();
		}
	}

}
